package cxf.spring.demo;

import com.jgoodies.forms.layout.CellConstraints;
import com.jgoodies.forms.layout.FormLayout;
import cxf.spring.demo.service.MessageService;
import cxf.spring.demo.service.UserService;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import javax.swing.*;

/**
 * User: Vlad Vinichenko (akerigan@gmail.com)
 * Date: 06.03.2009
 * Time: 22:31:27
 */
public class Client extends JFrame {

    protected UserService userService;
    protected MessageService messageService;

    private static Log log = LogFactory.getLog(Client.class);

    public UserService getUserService() {
        return userService;
    }

    public void setUserService(UserService userService) {
        this.userService = userService;
    }

    public MessageService getMessageService() {
        return messageService;
    }

    public void setMessageService(MessageService messageService) {
        this.messageService = messageService;
    }

    public Client() {
        super("Список пользователей");
        setDefaultCloseOperation(EXIT_ON_CLOSE);

        FormLayout formLayout = new FormLayout(
                "pref:grow",
                "default:none,2dlu,default:grow,2dlu,pref");

        getContentPane().setLayout(formLayout);

        CellConstraints cellConstraints = new CellConstraints();

        getContentPane().add(new JLabel("Список пользователей:"), cellConstraints.xy(1, 1));

        JList userList = new JList(new String[]{"one", "two", "three", "four"});
        getContentPane().add(userList, cellConstraints.xy(1, 3));

        JButton button = new JButton("Обновить");
        getContentPane().add(button, cellConstraints.xy(1, 5));

        // выводим окно на экран
        setSize(400, 300);
        setVisible(true);

    }

    public static void main(String[] args) {

//        ApplicationContext context = new ClassPathXmlApplicationContext("/applicationContext.xml");

        Client client = new Client();
//        client.setUserService((UserService) context.getBean("userService"));
//        client.setMessageService((MessageService) context.getBean("messageService"));

    }


}
